<?php
class model_newagk_usercompany extends gdl_components_basemodel
{

    public function primarykey() {
        return 'id';
    }

    public function tableName() {
        return 'agk_user_company';
    } 

	
    public function isUserCompanyExist($userid , $platform_id)
    {
        $res = $this->selectOne(['userId' => $userid, 'platformId' => $platform_id],'id,isdelete');
        return $res;
    }
	
	public function isUserCompanyInfo($userid=0,$identity_id=0,$platform_id=0)
    {
		if($userid){
			$map = ['userId' => $userid, 'platformId' => $platform_id];
		} else {
			$map = ['id' => $identity_id];
		}
        $res = $this->selectOne($map,'departmentId,departmentgroupId,companyId,admin_reg,jobTitle,isdelete');
        return $res;
    }
	
	public function getInfoArgOne($arrg=[],$field)
    {
		if(empty($arrg)) return false;
		return $this->selectOne($arrg, $field);
    }

}
